const express = require("express");
const app = express();
const parser = require("body-parser");
app.use(parser.urlencoded({ extended: true }));
//
app.get("/api/test", function (req, res) {
  console.log("sd");
});
//
const cors = require('cors')
app.use(cors())
const router = require("./router");
app.use("/api", router);
//错误
app.use((err, req, res, next) => {
  console.log("发生了错误！" + err.message);
  res.send("Error：" + err.message);
});

app.listen(3000, () => {
  console.log("http://localhost:3000");
});
